package org.example.Soution002;

import java.util.ArrayList;
import java.util.List;

public class SubSetsSolutionPro {
    public static void main(String[] args) {
        SubSetsSolutionPro solution = new SubSetsSolutionPro();
        int[] nums={1};
        System.out.println(solution.subsets(nums));
    }

    List<List<Integer>> result = new ArrayList<>();
    public List<List<Integer>> subsets(int[] nums) {
        int length = nums.length;
        List<Integer> tmp=new ArrayList<>();
        for(int i=0;i<(1<<length);i++){
            tmp.clear();
            for(int j=0;j<length;j++){
                if((i&(1<<j))!=0){
                    tmp.add(nums[j]);
                }
            }
            result.add(new ArrayList<>(tmp));
        }
        return result;
    }
}
